'\" te
.\" Copyright (C) 2008, Sun Microsystems, Inc. All Rights Reserved.
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH NET_ROUTETO 9F "May 1, 2008"
.SH NAME
net_routeto \- indicate which network interface packets are sent
.SH SYNOPSIS
.nf
#include <sys/neti.h>

\fBphy_if_t\fR \fBnet_routeto\fR(\fBconst\fR \fBnet_data_t\fR *\fInet\fR, \fBstruct\fR \fBsockaddr\fR *\fIaddress\fR,
     \fBstruct\fR \fBsockaddr\fR *\fInexthop\fR);
.fi

.SH INTERFACE LEVEL
illumos DDI specific (illumos DDI).
.SH PARAMETERS
.ne 2
.na
\fB\fInet\fR\fR
.ad
.RS 11n
value returned from a successful call to \fBnet_protocol_lookup\fR(9F).
.RE

.sp
.ne 2
.na
\fB\fIaddress\fR\fR
.ad
.RS 11n
network address to find a path out of the machine for.
.RE

.sp
.ne 2
.na
\fB\fInexthop\fR\fR
.ad
.RS 11n
pointer to the \fBsockaddr\fR structure in which to store the address of the
next hop. If this information is not required, the value \fBNULL\fR may be
passed instead.
.RE

.SH DESCRIPTION
The \fBnet_routeto()\fR function indicates which network interface packets
destined for a particular address would be sent out of, according to the
systems network routing tables. If \fBnext\fR is supplied as a non-\fBNULL\fR
pointer, the \fBIP\fR address of the \fBnexthop\fR router to be used is
returned in it.
.SH RETURN VALUES
The \fBnet_routeto()\fR function returns:
.sp
.ne 2
.na
\fB-1\fR
.ad
.RS 6n
The network protocol does not support this function.
.RE

.sp
.ne 2
.na
\fB0\fR
.ad
.RS 6n
This function cannot find a route for the address given.
.RE

.sp
.ne 2
.na
\fB>0\fR
.ad
.RS 6n
Indicates which network interface can be used to reach the given address.
.RE

.SH CONTEXT
The \fBnet_routeto()\fR function may be called from user,  kernel, or interrupt
context.
.SH ATTRIBUTES
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
Interface Stability	Committed
.TE

.SH SEE ALSO
.BR attributes (7),
.BR net_phygetnext (9F),
.BR net_phylookup (9F),
.BR net_protocol_lookup (9F)
